From: | Ben Hutchings |
Date: | 04 Aug 99 at 00:34:51 |
Subject: | Re: Re: (no subject) |
From: Ben Hutchings <womble@zzumbouk.demon.co.uk>
On Sun, Aug 01, 1999 at 01:28:39PM +0200, Allan Odgaard wrote:
> From: Allan Odgaard <Duff@DIKU.DK>
>
> On 31-Jul-99, Gregory Roberts II wrote:
>
> > [...]
> > A shared library is just that: shared by many processes. Therefore, it
> > doesn't have the context that dos.library needs to operate.
>
> I don't think this is entirely true. A library function should be
> viewed as an extension of a program, thus has the process-structure
> of the calling program. So most DOS functions are callable from a
> library, granted that library has been called from a process, even
> though many DOS functions can actually be called by tasks.
This only works if the calling process does not use asynchronous
DOS I/O. If you make DOS calls in your library function then you
should document that fact!
> I think that the only real unsafe thing to do in a library is start
> printing to stdout, as the process is likely not to have a stdout,
> plus 'printf()' doesn't seem to be re-entrant, atleast not in
> StormC... :-(
printf uses a static buffer in many implementations.
> But kprintf() works very well from libs :-)
If you use RawPutChar (as kprintf does) then you can let e.g. Sushi
handle buffering for you... much easier.